<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="screen-orientation" content="portrait">
    <meta name="x5-orientation" content="portrait">
    <title>丰源...小西天店</title>
    <link rel="stylesheet" href="../../styles/h5/reset.min.css"/>
    <link rel="stylesheet" href="../../styles/h5/errortankuang.css"/>
    <!--以上为公共css样式-->
    <link rel="stylesheet" href="../../styles/h5/index.css"/>

    <script charset="utf-8" type="text/javascript" src="../../scripts/h5/jquery-1.9.1.min.js"></script>
    <script charset="utf-8" type="text/javascript" src="../../scripts/h5/jquery.modal.js"></script>
    <!--以上为公共js文件-->
</head>
<body>
<div class="zz-top"></div>
<div class="zz-list">
    <ul>
        <li>
            <a class="zz-add-cashier" href="javascript:;">
                <span class="zz-add-icon"></span>
                <span class="zz-bank">添加收银员</span>
                <span class="zz-right-arrow"></span>
            </a>
        </li>
    </ul>
</div>
<div class="zz-cashier">收银员</div>
<div class="zz-list zz-cashier-list">
    <ul>
        <!--<li>
            <a href="javascript:;">
                <span class="zz-left">张三</span>
                <span class="zz-right-arrow"></span>
                <span class="zz-replace">有退款权限</span>
            </a>
        </li>
        <li>
            <a href="javascript:;">
                <span class="zz-left">李四</span>
                <span class="zz-right-arrow"></span>
                <span class="zz-replace">等待接受邀请</span>
            </a>
        </li>-->
    </ul>
</div>
<div class="zz-power">
    <span>收银员权限：</span>
    <span>查看本店近30天的账单</span>
</div>
</body>

<script charset="utf-8" type="text/javascript" src="../../scripts/h5/utils.js"></script>
<script charset="utf-8" type="text/javascript">
    var queryURLParameter = utils.queryURLParameter();
    var storeId=queryURLParameter.storeId;
    var dataHave = '';
    var dataNo = '';
    $("title").html(queryURLParameter.toreShortName);
    $("a.zz-add-cashier").attr("href", "../../html/h5/addCashier.html?storeId=" + queryURLParameter.storeId + "&toreShortName=" + queryURLParameter.toreShortName);
    
    
    function bindHTML() {
        var str = '';
        for (var i = 0; i < dataHave.length; i++) {
            var curDataHave = dataHave[i];
            var name = utils.removeSpace(curDataHave['name']);
            str += '<li>';
            str += '<a href="../../html/h5/cashierMsg.html?userId=' + curDataHave['userId'] + '&name=' + name + '&telephoneNo=' + curDataHave['telephoneNo'] + '&toreShortName=' + queryURLParameter.toreShortName + '&storeId=' + queryURLParameter.storeId + '">';
            str += '<span class="zz-left">' + name + '</span>';
            str += '<span class="zz-right-arrow"></span>';
            str += '</a>';
            str += '</li>';
        }

        for (var j = 0; j < dataNo.length; j++) {
            var curDataNo = dataNo[j];
            var nameNo = utils.removeSpace(curDataNo['name']);
            str += '<li>';
            str += '<a href="../../html/h5/requestCashier.html?userId=' + curDataNo['userId'] + '&name=' + nameNo + '&toreShortName=' + queryURLParameter.toreShortName + '&storeId=' + queryURLParameter.storeId + '">';
            str += '<span class="zz-left">' + nameNo + '</span>';
            str += '<span class="zz-right-arrow"></span>';
            str += '<span class="zz-replace">等待接受邀请</span>';
            str += '</a>';
            str += '</li>'
        }

        $(".zz-cashier-list ul").html(str);
    }
    $.ajax({
        url: utils.ajaxUrl()+"h5/cashier/receiver/getcashierList",
        async: false,
        data:{
            storeId:storeId
        },
        type: 'get',
        success: function (res) {
        	//console.log(res);
        	var res = JSON.parse(res);
        	//console.log(res);
            if (res && res.retCode == '0000') {
                dataHave = res["userRefundList"];
                dataNo = res["userInviteList"];
                bindHTML()
            }else {
                new $.modal({
                    content: res.retMsg,//弹框内容
                    showcontent: true,//false为弹出框组件二，true为弹出框组件一

                }).show();
            }
        }
    });
</script>
<script charset="utf-8" type="text/javascript" src="../../scripts/h5/index.js"></script>
<script charset="utf-8" type="text/javascript">

</script>
</html>